<!DOCTYPE html>
<!-- saved from url=(0077)file:///C:/Users/wangk/AppData/Local/Temp/mume2022519-12340-9kxfla.3i3p5.html -->
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>20220531数字签名实现逻辑</title>
      
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      
      <link rel="stylesheet" href="./20220531数字签名实现逻辑_files/katex.min.css">
      
      
      
      
      
      
      
      
      
      <style>
      /**
 * prism.js Github theme based on GitHub's theme.
 * @author Sam Clarke
 */
code[class*="language-"],
pre[class*="language-"] {
  color: #333;
  background: none;
  font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
  text-align: left;
  white-space: pre;
  word-spacing: normal;
  word-break: normal;
  word-wrap: normal;
  line-height: 1.4;

  -moz-tab-size: 8;
  -o-tab-size: 8;
  tab-size: 8;

  -webkit-hyphens: none;
  -moz-hyphens: none;
  -ms-hyphens: none;
  hyphens: none;
}

/* Code blocks */
pre[class*="language-"] {
  padding: .8em;
  overflow: auto;
  /* border: 1px solid #ddd; */
  border-radius: 3px;
  /* background: #fff; */
  background: #f5f5f5;
}

/* Inline code */
:not(pre) > code[class*="language-"] {
  padding: .1em;
  border-radius: .3em;
  white-space: normal;
  background: #f5f5f5;
}

.token.comment,
.token.blockquote {
  color: #969896;
}

.token.cdata {
  color: #183691;
}

.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
  color: #333;
}

.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
  color: #a71d5d;
}

.token.string,
.token.url,
.token.regex,
.token.attr-value {
  color: #183691;
}

.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
  color: #0086b3;
}

.token.tag,
.token.selector,
.token.prolog {
  color: #63a35c;
}

.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
  color: #795da3;
}

.token.entity {
  cursor: help;
}

.token.title,
.token.title .token.punctuation {
  font-weight: bold;
  color: #1d3e81;
}

.token.list {
  color: #ed6a43;
}

.token.inserted {
  background-color: #eaffea;
  color: #55a532;
}

.token.deleted {
  background-color: #ffecec;
  color: #bd2c00;
}

.token.bold {
  font-weight: bold;
}

.token.italic {
  font-style: italic;
}


/* JSON */
.language-json .token.property {
  color: #183691;
}

.language-markup .token.tag .token.punctuation {
  color: #333;
}

/* CSS */
code.language-css,
.language-css .token.function {
  color: #0086b3;
}

/* YAML */
.language-yaml .token.atrule {
  color: #63a35c;
}

code.language-yaml {
  color: #183691;
}

/* Ruby */
.language-ruby .token.function {
  color: #333;
}

/* Markdown */
.language-markdown .token.url {
  color: #795da3;
}

/* Makefile */
.language-makefile .token.symbol {
  color: #795da3;
}

.language-makefile .token.variable {
  color: #183691;
}

.language-makefile .token.builtin {
  color: #0086b3;
}

/* Bash */
.language-bash .token.keyword {
  color: #0086b3;
}

/* highlight */
pre[data-line] {
  position: relative;
  padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  background-color: transparent;
  display: block;
  width: 100%;
}

pre[data-line] .line-highlight {
  position: absolute;
  left: 0;
  right: 0;
  padding: inherit 0;
  margin-top: 1em;
  background: hsla(24, 20%, 50%,.08);
  background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
  pointer-events: none;
  line-height: inherit;
  white-space: pre;
}

pre[data-line] .line-highlight:before, 
pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-start);
  position: absolute;
  top: .4em;
  left: .6em;
  min-width: 1em;
  padding: 0 .5em;
  background-color: hsla(24, 20%, 50%,.4);
  color: hsl(24, 20%, 95%);
  font: bold 65%/1.5 sans-serif;
  text-align: center;
  vertical-align: .3em;
  border-radius: 999px;
  text-shadow: none;
  box-shadow: 0 1px white;
}

pre[data-line] .line-highlight[data-end]:after {
  content: attr(data-end);
  top: auto;
  bottom: .4em;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% -  300px);padding:2em calc(50% - 457px -  150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
/* Please visit the URL below for more information: */
/*   https://shd101wyy.github.io/markdown-preview-enhanced/#/customize-css */

      </style>
    </head>
    <body for="html-export">
      <div class="mume markdown-preview  ">
      <h4 class="mume-header" id="%E5%88%AB%E6%83%B3%E5%81%B7%E6%87%92%E7%9B%B4%E6%8E%A5%E6%8B%96%E5%90%8E%E9%9D%A2%E7%9C%8B%E4%BB%A3%E7%A0%81%E5%9B%A0%E4%B8%BA%E6%B6%89%E5%8F%8A%E5%88%B0%E9%9D%9E%E5%B8%B8%E5%A4%9A%E7%9A%84%E7%B3%BB%E7%BB%9F%E8%A1%A8%E7%BB%B4%E6%8A%A4%E8%87%AA%E5%BB%BA%E8%A1%A8%E7%BB%93%E6%9E%84%E7%AD%89">别想偷懒直接拖后面看代码，因为涉及到非常多的系统表维护，自建表，结构等。</h4>

<h3 class="mume-header" id="%E4%B8%BB%E8%A6%81%E6%98%AF%E5%AE%9E%E7%8E%B0%E6%80%9D%E8%B7%AF">主要是实现思路</h3>

<blockquote>
<p>涉及的相关表格，视图有如下：<br>
子对象维护视图：V_BALSUB<br>
对象表：BALOBJ<br>
应用程序：SIGNAPPL_V<br>
应用程序,对象 子对象维护视图：SIGNOBJECT_V</p>
</blockquote>
<h4 class="mume-header" id="%E6%AD%A5%E9%AA%A4%E5%A6%82%E4%B8%8B">步骤如下</h4>

<blockquote>
<ol>
<li>自定义应用程序<br>
Tcode:  SIGNA<br>
<img src="./20220531数字签名实现逻辑_files/pic01.png" alt="查看signa"></li>
</ol>
</blockquote>
<blockquote>
<ol start="2">
<li>自定义对象与子对象<br>
Tcode:  SLG0<br>
<img src="./20220531数字签名实现逻辑_files/pic02.png" alt="查看slgo"><br>
选中对象，双击上图子对象，创建子对象<br>
<img src="./20220531数字签名实现逻辑_files/pic03.png" alt="查看子对象"></li>
</ol>
</blockquote>
<blockquote>
<ol start="3">
<li>定义权限组，个体签名，签名策略等<br>
注意，spro路径不唯一，找到一个电子签名即可。<br>
举例路径<br>
Spro-&gt;跨应用组件-&gt;一般应用功能-&gt;数字签名-&gt;签名策略(相关配置)<br>
<img src="./20220531数字签名实现逻辑_files/pic04.png" alt="查看spro"><br>
定义权限组<br>
<img src="./20220531数字签名实现逻辑_files/pic05.png" alt="定义权限组"><br>
定义单独签字<br>
<img src="./20220531数字签名实现逻辑_files/pic06.png" alt="定义单独签字"><br>
定义签字策略<br>
<img src="./20220531数字签名实现逻辑_files/pic07.png" alt="定义签字策略"><br>
点击分配单个签名<br>
<img src="./20220531数字签名实现逻辑_files/pic08.png" alt="点击分配单个签名"><br>
输入单独签字以及权限组<br>
注意：涉及到权限组要和顾问沟通，sap_all是用有所有权限。<br>
查看自己权限可以使用su01,不过很有可能你连su01权限都没有。<br>
<img src="./20220531数字签名实现逻辑_files/pic09.png" alt="查看自己的权限"></li>
</ol>
</blockquote>
<blockquote>
<ol start="4">
<li>添加签名控制<br>
个人认为，签名控制虽然为自定义，但是和接口日志一样，虽然顾问或者&gt;客户没有明确提出来，但是我们默认都要增加的功能。</li>
</ol>
<ul>
<li>抬头结构<br>
<img src="./20220531数字签名实现逻辑_files/pic10.png" alt="查看控制表抬头结构"><br>
<img src="./20220531数字签名实现逻辑_files/pic12.png" alt="查看抬头维护数据"></li>
<li>明细结构<br>
<img src="./20220531数字签名实现逻辑_files/pic11.png" alt="查看控制表明细结构"><br>
<img src="./20220531数字签名实现逻辑_files/pic13.png" alt="查看明细维护数据"><br>
明细结构里面的控制维度为触发条件字段。例如示例的BP供应商主数据数字签名，控制维度是but000表里面的字段，供应商分组。<br>
<img src="./20220531数字签名实现逻辑_files/pic14.png" alt="查看明细维度"><br>
如果是物料主数据的话，推荐使用物料类型，其他的类似。</li>
</ul>
</blockquote>
<blockquote>
<ol start="5">
<li>创建元数据表，应需设计，SIGN_ID 必不可少）<br>
<img src="./20220531数字签名实现逻辑_files/pic15.png" alt="查看元数据表"></li>
</ol>
</blockquote>
<blockquote>
<ol start="6">
<li>创建log结构<br>
存日志</li>
</ol>
</blockquote>
<blockquote>
<ol start="7">
<li>维护相关视图</li>
</ol>
<ul>
<li>应用程序底表：SIGNAPPL 其维护视图：SIGNAPPL_V<br>
Tcode:  SIGNA</li>
<li>子对象底表:BALOBJ 其维护视图：V_BALSUB (维护该表时，请选择签名对象 ,这玩意是自己定义的对象，本示例使用的是Z_QM)<br>
维护对象Tcode：SLG0</li>
<li>维护签名对象底表</li>
</ul>
</blockquote>
<blockquote>
<ol start="8">
<li>定义日志结构<br>
SIGN_PROT_STRUC<br>
<img src="./20220531数字签名实现逻辑_files/pic16.png" alt="查看日志结构"></li>
</ol>
</blockquote>
<blockquote>
<ol start="9">
<li>维护SIGNOBJECT_V，为数字签名登记签名对象<br>
<img src="./20220531数字签名实现逻辑_files/pic17.png" alt="维护签名对象1"><br>
<img src="./20220531数字签名实现逻辑_files/pic18.png" alt="维护签名对象2"></li>
</ol>
</blockquote>
<blockquote>
<ol start="10">
<li>签名程序实现位置<br>
位置主要是保存增强增强点。常见的如下</li>
</ol>
<ul>
<li>物料在 BADI:BADI_MATERIAL_CHECK-&gt;CHECK_DATA</li>
<li>BOM 在 BADI: BOM_UPDATE-&gt;CHANGE_AT_SAVE</li>
<li>BP：自定义程序，函数模块，通过 BDT 配置实现 Tcode: BUPT</li>
</ul>
</blockquote>
<h4 class="mume-header" id="%E8%BF%99%E5%84%BF%E6%98%AF%E5%AE%9E%E7%8E%B0%E4%BB%A3%E7%A0%81">这儿是实现代码</h4>

<blockquote>
<p>这是BP主数据修改的电子签名<br>
有一些比较难搞的点，比如触发保存的按钮问题。正常我们习惯保存使用的是系统标准的保存按钮。比如下图。<br>
<img src="./20220531数字签名实现逻辑_files/pic20.png" alt="标准保存按钮"><br>
但是，总有一些奇怪的按钮可以触发保存操作。例如下图<br>
<img src="./20220531数字签名实现逻辑_files/pic21.png" alt="奇怪的保存1"><br>
<img src="./20220531数字签名实现逻辑_files/pic22.png" alt="奇怪的保存2"><br>
这几个按钮，都能触发保存操作，但是因为BP比较特殊，没有保存增强，只有保存前的数据校验。因此我们需要对这几个特殊的按钮进行限制。<br>
<img src="./20220531数字签名实现逻辑_files/pic23.png" alt="奇怪的保存解决方案"><br>
综上，具体问题具体分析。以下代码仅供参考。</p>
</blockquote>
<pre data-role="codeBlock" data-info="abap" class="language-abap"><span class="token keyword keyword-FUNCTION">FUNCTION</span> zqm_but000_event_dchck<span class="token punctuation">.</span>
<span class="token comment">*"----------------------------------------------------------------------</span>
<span class="token comment">*"*"本地接口：</span>
<span class="token comment">*"----------------------------------------------------------------------</span>

  <span class="token keyword keyword-CONSTANTS">CONSTANTS</span><span class="token punctuation">:</span>
    lc_si_str         <span class="token keyword keyword-TYPE">TYPE</span> signstrat   <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'ZQM002'</span><span class="token punctuation">,</span>
    lc_ds_application <span class="token keyword keyword-TYPE">TYPE</span> sign_appl   <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'Z_BP'</span><span class="token punctuation">,</span>
    lc_ds_signobject  <span class="token keyword keyword-TYPE">TYPE</span> sign_object <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'Z_QM'</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-CONSTANTS">CONSTANTS</span><span class="token punctuation">:</span>
    lc_state_sig_proc_new    <span class="token keyword keyword-TYPE">TYPE</span> sign_state    <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">' '</span><span class="token punctuation">,</span>
    lc_state_sig_proc_closed <span class="token keyword keyword-TYPE">TYPE</span> sign_state <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'1'</span><span class="token punctuation">,</span>
    lc_state_sig_proc_canc   <span class="token keyword keyword-TYPE">TYPE</span> sign_state <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'2'</span><span class="token punctuation">,</span>
    lc_state_sig_proc_open   <span class="token keyword keyword-TYPE">TYPE</span> sign_state <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'3'</span><span class="token punctuation">.</span>


  <span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span> ls_object <span class="token keyword keyword-TYPE">TYPE</span> zqmt001<span class="token punctuation">,</span>
        ls_bp     <span class="token keyword keyword-TYPE">TYPE</span> but000<span class="token punctuation">.</span>
  <span class="token keyword keyword-FIELD-SYMBOLS">FIELD-SYMBOLS</span><span class="token punctuation">:</span>&lt;fs&gt;     <span class="token keyword keyword-TYPE">TYPE</span> sy<span class="token token-operator punctuation">-</span>ucomm<span class="token punctuation">,</span>
                &lt;fs_bp&gt;  <span class="token keyword keyword-TYPE">TYPE</span> but000<span class="token token-operator punctuation">-</span>partner<span class="token punctuation">,</span>
                &lt;fs_grp&gt; <span class="token keyword keyword-TYPE">TYPE</span> but000<span class="token token-operator punctuation">-</span>bu_group<span class="token punctuation">.</span>
  <span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span> lv_state <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span><span class="token punctuation">.</span>

  <span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span> ls_ds_h <span class="token keyword keyword-TYPE">TYPE</span> zds_management_h<span class="token punctuation">,</span>
        lt_ds_i <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-TABLE">TABLE</span> <span class="token keyword keyword-OF">OF</span> zds_management_i<span class="token punctuation">,</span>
        ls_ds_i <span class="token keyword keyword-TYPE">TYPE</span> zds_management_i<span class="token punctuation">.</span>

  <span class="token keyword keyword-FIELD-SYMBOLS">FIELD-SYMBOLS</span><span class="token punctuation">:</span> &lt;ds_objkey&gt; <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-any">any</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span>fn_objkey  <span class="token keyword keyword-TYPE">TYPE</span> string<span class="token punctuation">,</span>   <span class="token eol-comment comment">" 定义变量用于保存字段名</span>
       ls_disable <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span><span class="token punctuation">.</span>


  <span class="token eol-comment comment">"Get partner</span>
  <span class="token keyword keyword-GET">GET</span> <span class="token keyword keyword-PARAMETER">PARAMETER</span> <span class="token keyword keyword-ID">ID</span> <span class="token string">'BPA'</span> <span class="token keyword keyword-FIELD">FIELD</span> ls_object<span class="token token-operator punctuation">-</span>partner<span class="token punctuation">.</span>
  <span class="token keyword keyword-IF">IF</span> ls_object<span class="token token-operator punctuation">-</span>partner <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>"Creation
    <span class="token keyword keyword-ASSIGN">ASSIGN</span> <span class="token punctuation">(</span><span class="token string">'(SAPLBUPA_DIALOG_JOEL)BUS_JOEL_MAIN-CREATION_NUMBER'</span><span class="token punctuation">)</span> <span class="token keyword keyword-TO">TO</span> &lt;fs_bp&gt;<span class="token punctuation">.</span>
    <span class="token keyword keyword-IF">IF</span> &lt;fs_bp&gt; <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-ASSIGNED">ASSIGNED</span><span class="token punctuation">.</span>
      ls_object<span class="token token-operator punctuation">-</span>partner <span class="token operator">=</span> &lt;fs_bp&gt;<span class="token punctuation">.</span>
    <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

  <span class="token keyword keyword-CLEAR">CLEAR</span><span class="token punctuation">:</span> ls_ds_h<span class="token punctuation">,</span> ls_disable<span class="token punctuation">,</span> ls_bp<span class="token punctuation">.</span>
  <span class="token keyword keyword-SELECT">SELECT</span> <span class="token keyword keyword-SINGLE">SINGLE</span> <span class="token operator">*</span> <span class="token keyword keyword-FROM">FROM</span> zds_management_h <span class="token keyword keyword-INTO">INTO</span> ls_ds_h
    <span class="token keyword keyword-WHERE">WHERE</span> sign_appl <span class="token operator">=</span> lc_ds_application
      <span class="token keyword keyword-AND">AND</span> sign_object <span class="token operator">=</span> lc_ds_signobject
      <span class="token keyword keyword-AND">AND</span> <span class="token keyword keyword-activation">activation</span> <span class="token operator">=</span> abap_true<span class="token punctuation">.</span>
  <span class="token keyword keyword-IF">IF</span> sy<span class="token token-operator punctuation">-</span>subrc <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">.</span>" <span class="token keyword keyword-Only">Only</span> activated
    <span class="token keyword keyword-CLEAR">CLEAR</span> lt_ds_i<span class="token punctuation">.</span>
    <span class="token keyword keyword-SELECT">SELECT</span> <span class="token operator">*</span> <span class="token keyword keyword-FROM">FROM</span> zds_management_i <span class="token keyword keyword-INTO">INTO</span> <span class="token keyword keyword-TABLE">TABLE</span> lt_ds_i
      <span class="token keyword keyword-WHERE">WHERE</span> sign_appl <span class="token operator">=</span> lc_ds_application
        <span class="token keyword keyword-AND">AND</span> sign_object <span class="token operator">=</span> lc_ds_signobject
        <span class="token keyword keyword-AND">AND</span> <span class="token keyword keyword-activation">activation</span> <span class="token operator">=</span> abap_true<span class="token punctuation">.</span>
    <span class="token keyword keyword-IF">IF</span> <span class="token keyword keyword-NOT">NOT</span> lt_ds_i <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-SELECT">SELECT</span> <span class="token keyword keyword-SINGLE">SINGLE</span> <span class="token operator">*</span> <span class="token keyword keyword-FROM">FROM</span> but000 <span class="token keyword keyword-INTO">INTO</span> ls_bp <span class="token keyword keyword-WHERE">WHERE</span> partner <span class="token operator">=</span> ls_object<span class="token token-operator punctuation">-</span>partner<span class="token punctuation">.</span>

      <span class="token keyword keyword-LOOP">LOOP</span> <span class="token keyword keyword-AT">AT</span> lt_ds_i <span class="token keyword keyword-INTO">INTO</span> ls_ds_i<span class="token punctuation">.</span>
        <span class="token keyword keyword-CLEAR">CLEAR</span> fn_objkey<span class="token punctuation">.</span>
        fn_objkey <span class="token operator">=</span> ls_ds_i<span class="token token-operator punctuation">-</span>sign_objkey<span class="token punctuation">.</span>

        <span class="token keyword keyword-IF">IF</span> ls_bp<span class="token token-operator punctuation">-</span>bu_group <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>"Get <span class="token keyword keyword-current">current</span> <span class="token keyword keyword-group">group</span>
          <span class="token keyword keyword-ASSIGN">ASSIGN</span> <span class="token punctuation">(</span><span class="token string">'(SAPLBUPA_DIALOG_JOEL)BUS_JOEL_MAIN-CREATION_GROUP'</span><span class="token punctuation">)</span> <span class="token keyword keyword-TO">TO</span> &lt;fs_grp&gt;<span class="token punctuation">.</span>
          <span class="token keyword keyword-IF">IF</span> &lt;fs_grp&gt; <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-ASSIGNED">ASSIGNED</span><span class="token punctuation">.</span>
            ls_bp<span class="token token-operator punctuation">-</span>bu_group <span class="token operator">=</span> &lt;fs_grp&gt;<span class="token punctuation">.</span>
          <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-ELSE">ELSE</span><span class="token punctuation">.</span>
          <span class="token keyword keyword-ASSIGN">ASSIGN</span> ls_bp<span class="token token-operator punctuation">-</span>bu_group <span class="token keyword keyword-TO">TO</span> &lt;fs_grp&gt;<span class="token punctuation">.</span>
        <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>


        <span class="token keyword keyword-ASSIGN">ASSIGN</span> <span class="token keyword keyword-COMPONENT">COMPONENT</span> fn_objkey <span class="token keyword keyword-OF">OF</span> <span class="token keyword keyword-STRUCTURE">STRUCTURE</span> ls_bp <span class="token keyword keyword-TO">TO</span> &lt;ds_objkey&gt;<span class="token punctuation">.</span>
        <span class="token keyword keyword-IF">IF</span> &lt;ds_objkey&gt; <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-ASSIGNED">ASSIGNED</span> <span class="token keyword keyword-AND">AND</span> &lt;ds_objkey&gt; <span class="token operator">=</span> ls_ds_i<span class="token token-operator punctuation">-</span>sign_objval<span class="token punctuation">.</span>
          ls_disable <span class="token operator">=</span> abap_true<span class="token punctuation">.</span>
        <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

        <span class="token keyword keyword-CLEAR">CLEAR</span> ls_ds_i<span class="token punctuation">.</span>
      <span class="token keyword keyword-ENDLOOP">ENDLOOP</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>


<span class="token comment">*    IF ls_disable = abap_false.</span>
    <span class="token keyword keyword-IF">IF</span> ls_disable <span class="token operator">=</span> abap_true<span class="token punctuation">.</span>
      <span class="token keyword keyword-ASSIGN">ASSIGN</span> <span class="token punctuation">(</span><span class="token string">'(SAPLBUS_LOCATOR)GV_OK_CODE'</span><span class="token punctuation">)</span> <span class="token keyword keyword-TO">TO</span> &lt;fs&gt;<span class="token punctuation">.</span>" <span class="token keyword keyword-Get">Get</span> Save action

      <span class="token eol-comment comment">"新增对其他保存方法的限制</span>
      <span class="token keyword keyword-IF">IF</span> &lt;fs&gt; <span class="token keyword keyword-EQ">EQ</span> <span class="token string">'SCREEN_1000_ACTIVITY'</span><span class="token punctuation">.</span>"
        <span class="token keyword keyword-MESSAGE">MESSAGE</span> <span class="token string">'不允许通过修改显示按钮进行保存'</span> <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'S'</span> <span class="token keyword keyword-DISPLAY">DISPLAY</span> <span class="token keyword keyword-LIKE">LIKE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
<span class="token comment">*        LEAVE TO LIST-PROCESSING.</span>
        <span class="token keyword keyword-LEAVE">LEAVE</span> <span class="token keyword keyword-TO">TO</span> <span class="token keyword keyword-SCREEN">SCREEN</span> <span class="token number">3000</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-ELSEIF">ELSEIF</span> &lt;fs&gt; <span class="token keyword keyword-EQ">EQ</span> <span class="token string">'BUS_MAIN_BACK'</span> <span class="token keyword keyword-OR">OR</span> &lt;fs&gt; <span class="token keyword keyword-EQ">EQ</span> <span class="token string">'BUS_MAIN_EXIT'</span><span class="token punctuation">.</span>"退出按钮
        <span class="token keyword keyword-MESSAGE">MESSAGE</span> <span class="token string">'请保存后退出'</span> <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'S'</span> <span class="token keyword keyword-DISPLAY">DISPLAY</span> <span class="token keyword keyword-LIKE">LIKE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-LEAVE">LEAVE</span> <span class="token keyword keyword-TO">TO</span> <span class="token keyword keyword-SCREEN">SCREEN</span> <span class="token number">3000</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>


      <span class="token keyword keyword-IF">IF</span> &lt;fs&gt; <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-ASSIGNED">ASSIGNED</span> <span class="token keyword keyword-AND">AND</span> &lt;fs&gt; <span class="token keyword keyword-EQ">EQ</span> <span class="token string">'BUS_MAIN_SAVE'</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-CLEAR">CLEAR</span> gv_error<span class="token punctuation">.</span>

        <span class="token eol-comment comment">"增加特定字段的判断。</span>
        <span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span>ls_but <span class="token keyword keyword-TYPE">TYPE</span> zqms002a<span class="token punctuation">.</span>"修改后信息
        <span class="token keyword keyword-IMPORT">IMPORT</span> ls_but <span class="token keyword keyword-FROM">FROM</span> <span class="token keyword keyword-MEMORY">MEMORY</span> <span class="token keyword keyword-ID">ID</span> <span class="token string">'LS_BUT'</span><span class="token punctuation">.</span>"修改后信息

        <span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span>ls_butcopy <span class="token keyword keyword-TYPE">TYPE</span> zqms002a<span class="token punctuation">.</span>"获取未修改信息，数据都在底表里面，如果没有就是新建，必定签名
        <span class="token keyword keyword-MOVE-CORRESPONDING">MOVE-CORRESPONDING</span> ls_bp <span class="token keyword keyword-TO">TO</span> ls_butcopy<span class="token punctuation">.</span>"取得底表信息
        <span class="token eol-comment comment">"如果为空，那么取不到值无所谓</span>
        <span class="token keyword keyword-SELECT">SELECT</span> <span class="token keyword keyword-SINGLE">SINGLE</span> land1<span class="token punctuation">,</span>street<span class="token punctuation">,</span>city1 <span class="token keyword keyword-FROM">FROM</span> lfa1
          <span class="token keyword keyword-LEFT">LEFT</span> <span class="token keyword keyword-JOIN">JOIN</span> adrc <span class="token keyword keyword-ON">ON</span> adrc<span class="token token-operator punctuation">~</span>addrnumber <span class="token operator">=</span> lfa1<span class="token token-operator punctuation">~</span>adrnr
<span class="token comment">*          INTO (@ls_butcopy-land1,@ls_butcopy-street,@ls_butcopy-city1)</span>
          <span class="token keyword keyword-INTO">INTO</span> <span class="token keyword keyword-CORRESPONDING">CORRESPONDING</span> <span class="token keyword keyword-FIELDS">FIELDS</span> <span class="token keyword keyword-OF">OF</span> @ls_butcopy
          <span class="token keyword keyword-WHERE">WHERE</span> lifnr <span class="token operator">=</span> @ls_bp<span class="token token-operator punctuation">-</span>partner<span class="token punctuation">.</span>

        <span class="token keyword keyword-IF">IF</span> ls_butcopy <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>
          <span class="token keyword keyword-SUBMIT">SUBMIT</span> zqmr_returnmes
          <span class="token keyword keyword-WITH">WITH</span> p_partn <span class="token operator">=</span> ls_object<span class="token token-operator punctuation">-</span>partner
          <span class="token keyword keyword-WITH">WITH</span> p_appl <span class="token operator">=</span> lc_ds_application
          <span class="token keyword keyword-WITH">WITH</span> p_obj <span class="token operator">=</span> lc_ds_signobject
          <span class="token keyword keyword-WITH">WITH</span> p_si_str <span class="token operator">=</span> lc_si_str
          <span class="token keyword keyword-AND">AND</span> <span class="token keyword keyword-RETURN">RETURN</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-ELSEIF">ELSEIF</span> ls_butcopy <span class="token operator">=</span> ls_but<span class="token punctuation">.</span>
        <span class="token keyword keyword-ELSEIF">ELSEIF</span> ls_butcopy <span class="token operator">&lt;&gt;</span> ls_but<span class="token punctuation">.</span>
          <span class="token keyword keyword-SUBMIT">SUBMIT</span> zqmr_returnmes
          <span class="token keyword keyword-WITH">WITH</span> p_partn <span class="token operator">=</span> ls_object<span class="token token-operator punctuation">-</span>partner
          <span class="token keyword keyword-WITH">WITH</span> p_appl <span class="token operator">=</span> lc_ds_application
          <span class="token keyword keyword-WITH">WITH</span> p_obj <span class="token operator">=</span> lc_ds_signobject
          <span class="token keyword keyword-WITH">WITH</span> p_si_str <span class="token operator">=</span> lc_si_str
          <span class="token keyword keyword-AND">AND</span> <span class="token keyword keyword-RETURN">RETURN</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-FREE">FREE</span> <span class="token keyword keyword-MEMORY">MEMORY</span> <span class="token keyword keyword-ID">ID</span> <span class="token string">'LS_BUT'</span><span class="token punctuation">.</span>

        <span class="token keyword keyword-IMPORT">IMPORT</span> sign_state <span class="token operator">=</span> lv_state <span class="token keyword keyword-FROM">FROM</span> <span class="token keyword keyword-MEMORY">MEMORY</span> <span class="token keyword keyword-ID">ID</span> <span class="token string">'ZDS_STATE'</span><span class="token punctuation">.</span>
        <span class="token keyword keyword-CASE">CASE</span> lv_state<span class="token punctuation">.</span>
          <span class="token keyword keyword-WHEN">WHEN</span> lc_state_sig_proc_closed<span class="token punctuation">.</span>

          <span class="token keyword keyword-WHEN">WHEN</span> lc_state_sig_proc_open<span class="token punctuation">.</span>
            <span class="token keyword keyword-CALL">CALL</span> <span class="token keyword keyword-FUNCTION">FUNCTION</span> <span class="token string">'BUS_MESSAGE_STORE'</span>
              <span class="token keyword keyword-EXPORTING">EXPORTING</span>
                arbgb <span class="token operator">=</span> <span class="token string">'ZDS'</span>
                msgty <span class="token operator">=</span> <span class="token string">'E'</span>
                txtnr <span class="token operator">=</span> <span class="token string">'001'</span><span class="token punctuation">.</span>
            gv_error <span class="token operator">=</span> abap_true<span class="token punctuation">.</span>
            <span class="token keyword keyword-EXIT">EXIT</span><span class="token punctuation">.</span>
          <span class="token keyword keyword-WHEN">WHEN</span> lc_state_sig_proc_canc<span class="token punctuation">.</span>

          <span class="token keyword keyword-WHEN">WHEN</span> <span class="token keyword keyword-OTHERS">OTHERS</span><span class="token punctuation">.</span>

        <span class="token keyword keyword-ENDCASE">ENDCASE</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

    <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-IF">IF</span> gv_error <span class="token keyword keyword-EQ">EQ</span> abap_true<span class="token punctuation">.</span>
      <span class="token keyword keyword-CALL">CALL</span> <span class="token keyword keyword-FUNCTION">FUNCTION</span> <span class="token string">'BUS_MESSAGE_STORE'</span>
        <span class="token keyword keyword-EXPORTING">EXPORTING</span>
          arbgb <span class="token operator">=</span> <span class="token string">'ZDS'</span>
          msgty <span class="token operator">=</span> <span class="token string">'E'</span>
          txtnr <span class="token operator">=</span> <span class="token string">'001'</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-EXIT">EXIT</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

  <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
<span class="token keyword keyword-ENDFUNCTION">ENDFUNCTION</span><span class="token punctuation">.</span>
</pre><p>这里面又有submit关键字。有空我整理下用法。</p>
<p>submit程序如下。</p>
<pre data-role="codeBlock" data-info="abap" class="language-abap"><span class="token comment">*&amp;---------------------------------------------------------------------*</span>
<span class="token comment">*&amp; Report ZQMR_RETURNMES</span>
<span class="token comment">*&amp;---------------------------------------------------------------------*</span>
<span class="token comment">*&amp;</span>
<span class="token comment">*&amp;---------------------------------------------------------------------*</span>
<span class="token keyword keyword-REPORT">REPORT</span> zqmr_returnmes<span class="token punctuation">.</span>

<span class="token keyword keyword-PARAMETERS">PARAMETERS</span><span class="token punctuation">:</span>
  p_partn  <span class="token keyword keyword-TYPE">TYPE</span> but000<span class="token token-operator punctuation">-</span>partner<span class="token punctuation">,</span>
  p_doctxt <span class="token keyword keyword-TYPE">TYPE</span> text40 <span class="token keyword keyword-DEFAULT">DEFAULT</span> <span class="token keyword keyword-TEXT">TEXT</span>-exa<span class="token punctuation">,</span>

<span class="token comment">* Sign object</span>
  p_appl   <span class="token keyword keyword-TYPE">TYPE</span> sign_appl<span class="token punctuation">,</span>
  p_obj    <span class="token keyword keyword-TYPE">TYPE</span> sign_object<span class="token punctuation">,</span>

<span class="token comment">* Sign types:</span>
<span class="token comment">* - Asynchronous with fixed user (A, default setting)</span>
<span class="token comment">* - Asynchronous with changeable user (B)</span>
<span class="token comment">* - Synchronous (with changeable user) (C)</span>
  p_ds_typ <span class="token keyword keyword-TYPE">TYPE</span> sign_type <span class="token keyword keyword-DEFAULT">DEFAULT</span> <span class="token string">'C'</span><span class="token punctuation">,</span>
<span class="token comment">* Signing user</span>
  p_signer <span class="token keyword keyword-TYPE">TYPE</span> signer <span class="token keyword keyword-DEFAULT">DEFAULT</span> sy<span class="token token-operator punctuation">-</span>uname<span class="token punctuation">,</span>
<span class="token comment">* Signature strategy</span>
  p_si_str <span class="token keyword keyword-TYPE">TYPE</span> signstrat <span class="token keyword keyword-MATCHCODE">MATCHCODE</span> <span class="token keyword keyword-OBJECT">OBJECT</span> sign_s_strategy<span class="token punctuation">,</span>
<span class="token comment">* Status of the file ('B' = booked, 'C' = cancelled)</span>
  p_status <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span> <span class="token keyword keyword-DEFAULT">DEFAULT</span> <span class="token string">'B'</span><span class="token punctuation">,</span>
<span class="token comment">* Flag to trigger update on database</span>
  p_savedb <span class="token keyword keyword-TYPE">TYPE</span> xfeld <span class="token keyword keyword-DEFAULT">DEFAULT</span> <span class="token string">'X'</span><span class="token punctuation">.</span>

<span class="token keyword keyword-DATA">DATA</span><span class="token punctuation">:</span>
  lt_sign              <span class="token keyword keyword-TYPE">TYPE</span> sign_ref_tab<span class="token punctuation">,</span>
  lt_sign_remark       <span class="token keyword keyword-TYPE">TYPE</span> sign_remark_tab<span class="token punctuation">,</span>
  lw_sign_remark       <span class="token keyword keyword-TYPE">TYPE</span> sign_remark_struc<span class="token punctuation">,</span>
  ls_selected_remark   <span class="token keyword keyword-TYPE">TYPE</span> sign_remark_struc<span class="token punctuation">,</span>
  lw_sign              <span class="token keyword keyword-TYPE">TYPE</span> sign_ref_struc<span class="token punctuation">,</span>
  ls_meta              <span class="token keyword keyword-TYPE">TYPE</span> zqmt001<span class="token punctuation">,</span>
  ls_dsig_bp           <span class="token keyword keyword-TYPE">TYPE</span> zqmt001<span class="token punctuation">,</span>
  lv_default_remark_id <span class="token keyword keyword-TYPE">TYPE</span> sign_remark_struc<span class="token token-operator punctuation">-</span>id<span class="token punctuation">,</span>
  lv_change_appl_data  <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span> <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">''</span><span class="token punctuation">,</span>
  lv_sign_state        <span class="token keyword keyword-TYPE">TYPE</span> sign_state<span class="token punctuation">,</span>
  lv_document          <span class="token keyword keyword-TYPE">TYPE</span> string<span class="token punctuation">,</span>
  lv_error_text        <span class="token keyword keyword-TYPE">TYPE</span> string<span class="token punctuation">,</span>
  lv_error_ds          <span class="token keyword keyword-TYPE">TYPE</span> xfeld <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">''</span><span class="token punctuation">,</span>
  lv_signing_finished  <span class="token keyword keyword-TYPE">TYPE</span> xfeld <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">''</span><span class="token punctuation">,</span>
  lr_runtime           <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-REF">REF</span> <span class="token keyword keyword-TO">TO</span> if_ds_runtime<span class="token punctuation">,</span>
  lr_sign_inst         <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-REF">REF</span> <span class="token keyword keyword-TO">TO</span> if_ds_sign<span class="token punctuation">,</span>
  lr_cx_metadata       <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-REF">REF</span> <span class="token keyword keyword-TO">TO</span> cx_ds_exception<span class="token punctuation">,</span>
  lr_cx_ds_escape      <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-REF">REF</span> <span class="token keyword keyword-TO">TO</span> cx_ds_exception<span class="token punctuation">,</span>         <span class="token eol-comment comment">"#EC NEEDED</span>
  lr_cx_ds_message     <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-REF">REF</span> <span class="token keyword keyword-TO">TO</span> cx_ds_message<span class="token punctuation">,</span>
  lr_cx_ds_exception   <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-REF">REF</span> <span class="token keyword keyword-TO">TO</span> cx_ds_exception<span class="token punctuation">.</span>

<span class="token keyword keyword-CONSTANTS">CONSTANTS</span><span class="token punctuation">:</span>
<span class="token comment">* Constants for the registration of the application and its</span>
<span class="token comment">* signature object</span>

<span class="token comment">* Constants that describe the state of a signature process</span>
  lc_state_sig_proc_new    <span class="token keyword keyword-TYPE">TYPE</span> sign_state    <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">' '</span><span class="token punctuation">,</span>
  lc_state_sig_proc_closed <span class="token keyword keyword-TYPE">TYPE</span> sign_state <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'1'</span><span class="token punctuation">,</span>
  lc_state_sig_proc_canc   <span class="token keyword keyword-TYPE">TYPE</span> sign_state <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'2'</span><span class="token punctuation">,</span>
  lc_state_sig_proc_open   <span class="token keyword keyword-TYPE">TYPE</span> sign_state <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'3'</span><span class="token punctuation">,</span>
  lc_true                  <span class="token keyword keyword-TYPE">TYPE</span> boole_d <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'X'</span><span class="token punctuation">,</span>
  lc_false                 <span class="token keyword keyword-TYPE">TYPE</span> boole_d <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">''</span><span class="token punctuation">,</span>
  lc_update_data           <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span> <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'U'</span><span class="token punctuation">,</span>
  lc_insert_data           <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span> <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'I'</span><span class="token punctuation">,</span>
  lc_no_data_change        <span class="token keyword keyword-TYPE">TYPE</span> <span class="token keyword keyword-c">c</span> <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">''</span><span class="token punctuation">,</span>
  lc_first_remark          <span class="token keyword keyword-TYPE">TYPE</span> sign_remark_struc<span class="token token-operator punctuation">-</span>id <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'01'</span><span class="token punctuation">,</span>
  lc_second_remark         <span class="token keyword keyword-TYPE">TYPE</span> sign_remark_struc<span class="token token-operator punctuation">-</span>id <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'02'</span><span class="token punctuation">,</span>
  lc_doctype_text          <span class="token keyword keyword-TYPE">TYPE</span> ssftype <span class="token keyword keyword-VALUE">VALUE</span> <span class="token string">'TXT'</span><span class="token punctuation">.</span>

<span class="token comment">************************************************************</span>
<span class="token comment">* Application specific part</span>
<span class="token comment">************************************************************</span>

<span class="token comment">* Get data of the application object from the database</span>
<span class="token comment">*SELECT SINGLE * FROM dsig_booking_ex INTO ls_dsig_booking_old</span>
<span class="token comment">*  WHERE doc_id = p_partner.</span>
<span class="token comment">*IF ls_dsig_booking_old IS INITIAL.</span>
<span class="token comment">** Create a new database entry</span>
<span class="token comment">*  lv_change_appl_data = lc_insert_data.</span>
<span class="token comment">*ELSE.</span>
<span class="token comment">* Update existing database entry</span>
lv_change_appl_data <span class="token operator">=</span> lc_update_data<span class="token punctuation">.</span>
<span class="token comment">*ENDIF.</span>

<span class="token comment">* Transfer the entered parameter values</span>
<span class="token comment">*ls_dsig_booking_new-mandt          = sy-mandt.</span>
<span class="token comment">*ls_dsig_booking_new-doc_id         = p_partner.</span>
<span class="token comment">*ls_dsig_booking_new-booking_txt    = p_doctxt.</span>
<span class="token comment">*ls_dsig_booking_new-booking_status = p_status.</span>

<span class="token comment">************************************************************</span>
<span class="token comment">* Implementation part of the signature tool</span>
<span class="token comment">************************************************************</span>

<span class="token keyword keyword-CLASS">CLASS</span> cl_ds_runtime <span class="token keyword keyword-DEFINITION">DEFINITION</span> <span class="token keyword keyword-LOAD">LOAD</span><span class="token punctuation">.</span>

<span class="token comment">* Get DS runtime object</span>
lr_runtime <span class="token operator">=</span> cl_ds_runtime<span class="token token-operator punctuation">=&gt;</span>get_instance<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>

<span class="token comment">* Fill the remark table</span>
lw_sign_remark<span class="token token-operator punctuation">-</span>id <span class="token operator">=</span> lc_first_remark<span class="token punctuation">.</span>
lw_sign_remark<span class="token token-operator punctuation">-</span>sign_remark <span class="token operator">=</span> <span class="token keyword keyword-TEXT">TEXT</span>-dbk<span class="token punctuation">.</span>
<span class="token keyword keyword-INSERT">INSERT</span> lw_sign_remark <span class="token keyword keyword-INTO">INTO</span> <span class="token keyword keyword-TABLE">TABLE</span> lt_sign_remark<span class="token punctuation">.</span>
<span class="token comment">* First remark should be set as the default remark in the</span>
<span class="token comment">* remark list box of the signature popup screen</span>
lv_default_remark_id <span class="token operator">=</span> lw_sign_remark<span class="token token-operator punctuation">-</span>id<span class="token punctuation">.</span>

lw_sign_remark<span class="token token-operator punctuation">-</span>id <span class="token operator">=</span> lc_second_remark<span class="token punctuation">.</span>
lw_sign_remark<span class="token token-operator punctuation">-</span>sign_remark <span class="token operator">=</span> <span class="token keyword keyword-TEXT">TEXT</span>-dca<span class="token punctuation">.</span>
<span class="token keyword keyword-INSERT">INSERT</span> lw_sign_remark <span class="token keyword keyword-INTO">INTO</span> <span class="token keyword keyword-TABLE">TABLE</span> lt_sign_remark<span class="token punctuation">.</span>
<span class="token comment">* Fill the meta data structure</span>
ls_meta<span class="token token-operator punctuation">-</span>partner <span class="token operator">=</span> p_partn<span class="token punctuation">.</span>

<span class="token keyword keyword-CLEAR">CLEAR</span> ls_dsig_bp<span class="token punctuation">.</span>
ls_dsig_bp<span class="token token-operator punctuation">-</span>mandt          <span class="token operator">=</span> sy<span class="token token-operator punctuation">-</span>mandt<span class="token punctuation">.</span>
ls_dsig_bp<span class="token token-operator punctuation">-</span>partner <span class="token operator">=</span> p_partn<span class="token punctuation">.</span>

<span class="token comment">* Check if a signature instance exists for the meta data</span>
<span class="token keyword keyword-TRY">TRY</span><span class="token punctuation">.</span>
    lt_sign <span class="token operator">=</span> lr_runtime<span class="token token-operator punctuation">-&gt;</span>get_by_meta<span class="token punctuation">(</span>
            im_appl         <span class="token operator">=</span> p_appl
            im_object       <span class="token operator">=</span> p_obj
            im_meta         <span class="token operator">=</span> ls_meta <span class="token punctuation">)</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_metadata <span class="token keyword keyword-INTO">INTO</span> lr_cx_metadata<span class="token punctuation">.</span>
    <span class="token keyword keyword-IF">IF</span> lr_cx_metadata<span class="token token-operator punctuation">-&gt;</span>textid <span class="token operator">=</span>
      cx_ds_metadata<span class="token token-operator punctuation">=&gt;</span>no_instance_for_metadata<span class="token punctuation">.</span>
<span class="token comment">*     Check note 789924 to get more details why the exception</span>
<span class="token comment">*     cx_ds_metadata=&gt;no_instance_for_metadata is raised</span>
<span class="token comment">*     Create a new instance</span>
      lv_sign_state <span class="token operator">=</span> lc_state_sig_proc_new<span class="token punctuation">.</span>
    <span class="token keyword keyword-ELSE">ELSE</span><span class="token punctuation">.</span>
<span class="token comment">*     Internal error</span>
      lv_error_text <span class="token operator">=</span> lr_cx_metadata<span class="token token-operator punctuation">-&gt;</span>get_text<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> lv_error_text <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
<span class="token keyword keyword-ENDTRY">ENDTRY</span><span class="token punctuation">.</span>

<span class="token comment">* Signature process was triggered for meta data before</span>
<span class="token comment">* table lt_sign filled -&gt; get first entry</span>
<span class="token keyword keyword-IF">IF</span> <span class="token keyword keyword-NOT">NOT</span> lt_sign <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-READ">READ</span> <span class="token keyword keyword-TABLE">TABLE</span> lt_sign <span class="token keyword keyword-INTO">INTO</span> lw_sign <span class="token keyword keyword-INDEX">INDEX</span> <span class="token number">1</span><span class="token punctuation">.</span>
  lr_sign_inst <span class="token operator">=</span> lw_sign<span class="token token-operator punctuation">-</span>sign_inst<span class="token punctuation">.</span>
<span class="token comment">* Check the state of the signature process</span>
  <span class="token keyword keyword-TRY">TRY</span><span class="token punctuation">.</span>
      lv_sign_state <span class="token operator">=</span> lr_sign_inst<span class="token token-operator punctuation">-&gt;</span>get_state<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_exception <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_exception<span class="token punctuation">.</span>
<span class="token comment">*     Internal error</span>
      lv_error_text <span class="token operator">=</span> lr_cx_ds_exception<span class="token token-operator punctuation">-&gt;</span>get_text<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> lv_error_text <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDTRY">ENDTRY</span><span class="token punctuation">.</span>
<span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

<span class="token comment">* Check if a new instance must be created for the meta data (not</span>
<span class="token comment">* necessary if signing procedure is already in process)</span>
<span class="token keyword keyword-IF">IF</span> <span class="token keyword keyword-NOT">NOT</span> lv_sign_state <span class="token operator">=</span> lc_state_sig_proc_open<span class="token punctuation">.</span>
<span class="token comment">* Create new signature instance for meta data</span>
  <span class="token keyword keyword-TRY">TRY</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-CALL">CALL</span> <span class="token keyword keyword-METHOD">METHOD</span> lr_runtime<span class="token token-operator punctuation">-&gt;</span>create
        <span class="token keyword keyword-EXPORTING">EXPORTING</span>
          im_appl      <span class="token operator">=</span> p_appl
          im_object    <span class="token operator">=</span> p_obj
          im_meta      <span class="token operator">=</span> ls_meta
          im_type      <span class="token operator">=</span> p_ds_typ
          im_strategy  <span class="token operator">=</span> p_si_str
          im_store_doc <span class="token operator">=</span> lc_true
        <span class="token keyword keyword-RECEIVING">RECEIVING</span>
          <span class="token keyword keyword-result">result</span>       <span class="token operator">=</span> lr_sign_inst<span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_exception <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_exception<span class="token punctuation">.</span>
<span class="token comment">*     Internal error</span>
      lv_error_text <span class="token operator">=</span> lr_cx_ds_exception<span class="token token-operator punctuation">-&gt;</span>get_text<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> lv_error_text <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDTRY">ENDTRY</span><span class="token punctuation">.</span>
<span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

<span class="token comment">* Transfer entered text into appropriate variable</span>
lv_document <span class="token operator">=</span> p_doctxt<span class="token punctuation">.</span>

<span class="token comment">* Sign it</span>
<span class="token keyword keyword-WHILE">WHILE</span> lv_signing_finished <span class="token operator">=</span> lc_false<span class="token punctuation">.</span>
  <span class="token keyword keyword-TRY">TRY</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-CALL">CALL</span> <span class="token keyword keyword-METHOD">METHOD</span> lr_sign_inst<span class="token token-operator punctuation">-&gt;</span>sign
        <span class="token keyword keyword-EXPORTING">EXPORTING</span>
          im_signer            <span class="token operator">=</span> p_signer
          im_doc_txt           <span class="token operator">=</span> lv_document
          im_doctype           <span class="token operator">=</span> lc_doctype_text
          im_remarks           <span class="token operator">=</span> lt_sign_remark
          im_default_remark_id <span class="token operator">=</span> lv_default_remark_id
        <span class="token keyword keyword-IMPORTING">IMPORTING</span>
          ex_sel_remark        <span class="token operator">=</span> ls_selected_remark<span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_escape <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_escape<span class="token punctuation">.</span>
<span class="token comment">*     User cancelled the individual signature -&gt; don't change the</span>
<span class="token comment">*     application data and don't update the database tables</span>
      lv_change_appl_data <span class="token operator">=</span> lc_false<span class="token punctuation">.</span>
      lv_signing_finished <span class="token operator">=</span> lc_false<span class="token punctuation">.</span>

      lv_sign_state <span class="token operator">=</span> lc_state_sig_proc_open<span class="token punctuation">.</span>
      <span class="token keyword keyword-EXPORT">EXPORT</span> sign_state <span class="token keyword keyword-FROM">FROM</span> lv_sign_state <span class="token keyword keyword-TO">TO</span> <span class="token keyword keyword-MEMORY">MEMORY</span> <span class="token keyword keyword-ID">ID</span> <span class="token string">'ZDS_STATE'</span><span class="token punctuation">.</span>

      <span class="token keyword keyword-RETURN">RETURN</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_message <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_message<span class="token punctuation">.</span>
<span class="token comment">*     Transfer messages (as error messages)</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> <span class="token keyword keyword-ID">ID</span> lr_cx_ds_message<span class="token token-operator punctuation">-&gt;</span>msgid <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span>
      <span class="token keyword keyword-NUMBER">NUMBER</span> lr_cx_ds_message<span class="token token-operator punctuation">-&gt;</span>msgno<span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_context <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_exception<span class="token punctuation">.</span>
      lv_error_text <span class="token operator">=</span> lr_cx_ds_exception<span class="token token-operator punctuation">-&gt;</span>get_text<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> lv_error_text <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_exception <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_exception<span class="token punctuation">.</span>
      lv_error_text <span class="token operator">=</span> lr_cx_ds_exception<span class="token token-operator punctuation">-&gt;</span>get_text<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> lv_error_text <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDTRY">ENDTRY</span><span class="token punctuation">.</span>

<span class="token comment">*   The application could use the information which remark was</span>
<span class="token comment">*   selected by the user (ls_selected_remark) to trigger application-</span>
<span class="token comment">*   specific actions..</span>

<span class="token comment">* Get signature state</span>
  <span class="token keyword keyword-CLEAR">CLEAR</span> lv_sign_state<span class="token punctuation">.</span>
  <span class="token keyword keyword-TRY">TRY</span><span class="token punctuation">.</span>
      lv_sign_state <span class="token operator">=</span> lr_sign_inst<span class="token token-operator punctuation">-&gt;</span>get_state<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-CATCH">CATCH</span> cx_ds_exception <span class="token keyword keyword-INTO">INTO</span> lr_cx_ds_exception<span class="token punctuation">.</span>
<span class="token comment">*     Internal error</span>
      lv_error_text <span class="token operator">=</span> lr_cx_ds_exception<span class="token token-operator punctuation">-&gt;</span>get_text<span class="token punctuation">(</span> <span class="token punctuation">)</span><span class="token punctuation">.</span>
      <span class="token keyword keyword-MESSAGE">MESSAGE</span> lv_error_text <span class="token keyword keyword-TYPE">TYPE</span> <span class="token string">'E'</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDTRY">ENDTRY</span><span class="token punctuation">.</span>

<span class="token comment">* Trigger status changes depending on the status of the</span>
<span class="token comment">* signature process</span>
  <span class="token keyword keyword-EXPORT">EXPORT</span> sign_state <span class="token keyword keyword-FROM">FROM</span> lv_sign_state <span class="token keyword keyword-TO">TO</span> <span class="token keyword keyword-MEMORY">MEMORY</span> <span class="token keyword keyword-ID">ID</span> <span class="token string">'ZDS_STATE'</span><span class="token punctuation">.</span>

  <span class="token keyword keyword-CASE">CASE</span> lv_sign_state<span class="token punctuation">.</span>

    <span class="token keyword keyword-WHEN">WHEN</span> lc_state_sig_proc_closed<span class="token punctuation">.</span>
<span class="token comment">*     Signature process finished</span>
      lv_signing_finished <span class="token operator">=</span> lc_true<span class="token punctuation">.</span>
    <span class="token keyword keyword-WHEN">WHEN</span> lc_state_sig_proc_open<span class="token punctuation">.</span>


    <span class="token keyword keyword-WHEN">WHEN</span> lc_state_sig_proc_canc<span class="token punctuation">.</span>
      lv_signing_finished <span class="token operator">=</span> lc_true<span class="token punctuation">.</span>
<span class="token comment">*     Execute application action -&gt; don't set the status, but update the</span>
<span class="token comment">*     digital signature process</span>
      lv_change_appl_data <span class="token operator">=</span> lc_false<span class="token punctuation">.</span>
    <span class="token keyword keyword-WHEN">WHEN</span> <span class="token keyword keyword-OTHERS">OTHERS</span><span class="token punctuation">.</span>
<span class="token comment">*     ERROR!!!</span>
      lv_signing_finished <span class="token operator">=</span> lc_false<span class="token punctuation">.</span>
      lv_error_ds <span class="token operator">=</span> lc_true<span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDCASE">ENDCASE</span><span class="token punctuation">.</span>

<span class="token comment">* For asynchronous signature processes the WHILE loop must</span>
<span class="token comment">* be left after one signer signed</span>
  <span class="token keyword keyword-IF">IF</span> p_ds_typ <span class="token operator">=</span> lr_runtime<span class="token token-operator punctuation">-&gt;</span>co_type_async <span class="token keyword keyword-OR">OR</span>
     p_ds_typ <span class="token operator">=</span> lr_runtime<span class="token token-operator punctuation">-&gt;</span>co_type_async_ch<span class="token punctuation">.</span>
    lv_signing_finished <span class="token operator">=</span> lc_true<span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

  <span class="token keyword keyword-IF">IF</span> <span class="token keyword keyword-NOT">NOT</span> ls_selected_remark <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>
<span class="token comment">*   User selected a remark</span>
  <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>

<span class="token keyword keyword-ENDWHILE">ENDWHILE</span><span class="token punctuation">.</span>

<span class="token keyword keyword-CHECK">CHECK</span> lv_error_ds <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>
<span class="token comment">* Update task only if parameter value is set</span>
<span class="token keyword keyword-IF">IF</span> p_savedb <span class="token operator">=</span> lc_true<span class="token punctuation">.</span>
  <span class="token keyword keyword-CASE">CASE</span> lv_change_appl_data<span class="token punctuation">.</span>
    <span class="token keyword keyword-WHEN">WHEN</span> lc_update_data<span class="token punctuation">.</span>
<span class="token comment">*      MODIFY zmmt_ds_meta_bp FROM ls_dsig_bp."</span>
      <span class="token keyword keyword-IF">IF</span> sy<span class="token token-operator punctuation">-</span>subrc <span class="token operator">&lt;&gt;</span> <span class="token number">0</span><span class="token punctuation">.</span>
        lv_error_ds <span class="token operator">=</span> lc_true<span class="token punctuation">.</span>
      <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-WHEN">WHEN</span> lc_no_data_change<span class="token punctuation">.</span>
<span class="token comment">*     Application data should not be changed -&gt; no status change</span>
<span class="token comment">*     if signature process was cancelled</span>
      <span class="token keyword keyword-CLEAR">CLEAR</span> ls_dsig_bp<span class="token punctuation">.</span>
  <span class="token keyword keyword-ENDCASE">ENDCASE</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-IF">IF</span> lv_error_ds <span class="token keyword keyword-IS">IS</span> <span class="token keyword keyword-INITIAL">INITIAL</span><span class="token punctuation">.</span>
    <span class="token keyword keyword-COMMIT">COMMIT</span> <span class="token keyword keyword-WORK">WORK</span><span class="token punctuation">.</span>
  <span class="token keyword keyword-ELSE">ELSE</span><span class="token punctuation">.</span>
<span class="token comment">*   Internal error -&gt; no commit work execution possible</span>
  <span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>
<span class="token keyword keyword-ENDIF">ENDIF</span><span class="token punctuation">.</span>


<span class="token keyword keyword-CLEAR">CLEAR</span><span class="token punctuation">:</span> lv_error_ds<span class="token punctuation">,</span> lv_signing_finished<span class="token punctuation">.</span>
</pre><p>文本元素如下<br>
<img src="./20220531数字签名实现逻辑_files/pic19.png" alt="文本元素"></p>
<p>原理是通过submit的程序，进入报错的页面。</p>
<p>具体逻辑可以研究下。D66系统有物料主数据的数字签名增强。</p>

      </div>
      
      
    
    
    
    
    
    
    
    
  </body></html>